<?php

/**
 * This is the model class for table "luastanahnonsawah".
 *
 * The followings are the available columns in table 'luastanahnonsawah':
 * @property integer $ltns_id
 * @property integer $id_kecamatan
 * @property integer $tegalkebun
 * @property integer $ladanghuma
 * @property integer $perkebunan
 * @property integer $hutanrakyat
 * @property integer $tambak
 * @property integer $kolamempang
 * @property integer $penggembalaan
 * @property integer $nouse
 * @property integer $lainlain
 * @property integer $jumlah
 * @property integer $tahun
 *
 * The followings are the available model relations:
 * @property Kecamatan $idKecamatan
 */
class Luastanahnonsawah extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Luastanahnonsawah the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'luastanahnonsawah';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('id_kecamatan, tegalkebun, ladanghuma, perkebunan, hutanrakyat, tambak, kolamempang, penggembalaan, nouse, lainlain, jumlah, tahun', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('ltns_id, id_kecamatan, tegalkebun, ladanghuma, perkebunan, hutanrakyat, tambak, kolamempang, penggembalaan, nouse, lainlain, jumlah, tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'idKecamatan' => array(self::BELONGS_TO, 'Kecamatan', 'id_kecamatan'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'ltns_id' => 'Ltns',
			'id_kecamatan' => 'Id Kecamatan',
			'tegalkebun' => 'Tegal/Kebun',
			'ladanghuma' => 'Ladang Huma',
			'perkebunan' => 'Perkebunan',
			'hutanrakyat' => 'Hutan Rakyat',
			'tambak' => 'Tambak',
			'kolamempang' => 'Kolam Empang',
			'penggembalaan' => 'Penggembalaan',
			'nouse' => 'Nouse',
			'lainlain' => 'Lain-lain',
			'jumlah' => 'Jumlah',
			'tahun' => 'Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('ltns_id',$this->ltns_id);
		$criteria->compare('id_kecamatan',$this->id_kecamatan);
		$criteria->compare('tegalkebun',$this->tegalkebun);
		$criteria->compare('ladanghuma',$this->ladanghuma);
		$criteria->compare('perkebunan',$this->perkebunan);
		$criteria->compare('hutanrakyat',$this->hutanrakyat);
		$criteria->compare('tambak',$this->tambak);
		$criteria->compare('kolamempang',$this->kolamempang);
		$criteria->compare('penggembalaan',$this->penggembalaan);
		$criteria->compare('nouse',$this->nouse);
		$criteria->compare('lainlain',$this->lainlain);
		$criteria->compare('jumlah',$this->jumlah);
		$criteria->compare('tahun',$this->tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}